import Vue from 'vue'
import VueRouter from 'vue-router'
import Home from '../views/index.vue'

Vue.use(VueRouter)

const routes = [
    // { path: '/', redirect: '/index' },
    {
        path: '/',
        component: () => import('@/views/index.vue'),
        children: [
            {
                path: '',
                component: () => import('@/views/home/index.vue'),
                meta: {
                    title: "首页",
                    icon: 'el-icon-platform-eleme'
                },
                name: 'Home'
            },
            {
                path: 'awards',
                component: () => import('@/views/awards/index.vue'),
                meta: {
                    title: "奖项",
                    icon: 'el-icon-user-solid'
                },
                name: 'Awards'
            },
            {
                path: 'scholar',
                component: () => import('@/views/scholar/index.vue'),
                meta: {
                    title: "学者",
                    icon: 'el-icon-user-solid'
                },
                name: 'Scholar'
            },
            {
                path: 'scholarDetail',
                component: () => import('@/views/scholar/scholarDetail.vue'),
                meta: {
                    title: "学者详情页",
                    icon: 'el-icon-user-solid'
                },
                name: 'scholarDetail'
            },
        ]
    },

    {
        path: '/about',
        name: 'About',
        // route level code-splitting
        // this generates a separate chunk (about.[hash].js) for this route
        // which is lazy-loaded when the route is visited.
        component: () => import(/* webpackChunkName: "about" */ '../views/home/index.vue')
    }
]

const router = new VueRouter({
    mode: 'history',
    base: process.env.BASE_URL,
    routes
})

export default router
